import { createRequire } from "module";
import path from "path";

const requireds = createRequire(import.meta.url);
const __dirname = path.resolve();

const { defineConfig, build } = requireds("vite");
const vue = requireds("@vitejs/plugin-vue");

build(
  defineConfig({
    configFile: false,
    publicDir: false,
    plugins: [vue()],
    build: {
      rollupOptions: {
        external: ["vue"],
        output: {
          globals: {
            vue: "Vue",
          },
        },
      },
      lib: {
        entry: "./src/install.js",
        name: "kdUI",
        fileName: "kdUI",
      },
      outDir: path.resolve(__dirname, "lib"),
    },
  })
);
